﻿@model Core.Manage.User.GrainBuyerVWEntity
    @using XStudio.Core.Ext
    @using XStudio.Framework.Util
    @using XStudio.WebFramework.Mvc.Extensions
    <script type="text/javascript">
        var GrainBuyerInput = {};

        GrainBuyerInput.Save = function (e) {
            var frm = $(e).parents("form").first();
            if (!$(frm).valid())
                return;

            $.post($(frm).attr("action"), $(frm).serialize(), function (data) {
                if (data.IsOK) {
                    //刷新列表
                    $('#tbGrainBuyerList').datagrid('reload');
                    //关闭窗口
                    $.closeWin(e);
                }
                else
                    alert(data.Description);
            });
        };

        GrainBuyerInput.Back = function (e) {
            $.closeWin(e);
        };

        //页面加载
        $(function () {
            var v = $('#frmGrainBuyerInput').validate({
                rules: {
                    Account: { required: true },
                    Name: { required: true },
                    AlipayAccount: { required: true },
                    AlipayName: { required: true },
                    Password: { required: true },
                    Content: { required: true },
                    CommissionRules: { required: true }
                },
                messages: {
                    Account: { required: "必须填" },
                    Name: { required: "必须填" },
                    AlipayAccount: { required: "必须填" },
                    AlipayName: { required: "必须填" },
                    Password: { required: "必须填" },
                    Content: { required: "必须填" },
                    CommissionRules: { required: "必须填" }
                }
            });
        });
    </script>
    <input type="hidden" name="IsEdit" id="IsEdit" value="@ViewBag.IsEdit" />
    <form name="frmGrainBuyerInput" id="frmGrainBuyerInput" method=post action="@Url.Action(@ViewContext.RouteData.Values["Action"].ToString())">
        <table class="tbl-input" cellspacing="0" style="width: 100%">
            <colgroup>
                <col style="width: 100px;" />
                <col class="w5">
                <col />
            </colgroup>
            <tbody>
                @if (string.Equals(ViewContext.RouteData.Values["Action"].ToString(), "Edit", StringComparison.InvariantCultureIgnoreCase))
            {
                    <tr>
                        <th>
                            帐号：
                        </th>
                        <td>
                            @Html.TextBoxFor(t => t.Account, new { disabled = "disabled", @readonly = "readonly", style = "width:200px", maxlength = 20 })
                        </td>
                        <td class="slight">
                            <span class="btn-infomust">必填项</span>
                        </td>
                    </tr>
                }
                else
                {
                    <tr>
                        <th>
                            帐号：
                        </th>
                        <td>
                            @Html.TextBoxFor(t => t.Account, new { style = "width:200px", maxlength = 20 })
                        </td>
                        <td class="slight">
                            <span class="btn-infomust">必填项</span>
                        </td>
                    </tr>
                }

                <tr>
                    <th>
                        密码：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.Password, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-infomust">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        名称：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.Name, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-infomust">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        地址：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.Address, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-info">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        联系人：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.LikeUserName, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-info">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        联系电话：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.LikePhone, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-info">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        支付宝帐号：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.AlipayAccount, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-infomust">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        支付宝名称：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.AlipayName, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-infomust">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        佣金：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.CommissionRules, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-infomust">必填项</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        简介：
                    </th>
                    <td>
                        @Html.TextBoxFor(t => t.Content, new { style = "width:200px", maxlength = 20 })
                    </td>
                    <td class="slight">
                        <span class="btn-infomust">必填项</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" style="text-align: center;">
                        <p class="op">

                            <input type="button" id="btnSave" onclick="GrainBuyerInput.Save(this);" class="btn-8" value="保存" />
                            <input type="button" value="返回" onclick="GrainBuyerInput.Back(this);" class="btn-8" />
                        </p>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
